//
//  ViewController.m
//  Turntable
//
//  Created by yaqiang bi on 2017/3/10.
//  Copyright © 2017年 yaqiang bi. All rights reserved.
//

#import "ViewController.h"
#import "TurntableVC.h"
#import "SlotsVC.h"
#define screenHeight [[UIScreen mainScreen] bounds].size.height                 //屏幕宽度
#define screenWidth [[UIScreen mainScreen] bounds].size.width                   //屏幕高度
@interface ViewController ()<UITableViewDelegate,UITableViewDataSource>
@property (nonatomic,strong) UITableView *mainTableView;
@property (nonatomic,strong) NSMutableArray *dataMarr;              //数据源
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    self.dataMarr = [NSMutableArray arrayWithObjects:@"圆形转盘", @"老虎机", nil];
    
    [self initViews];
}
#pragma -mark 界面搭建
-(void)initViews{
    self.mainTableView = [[UITableView alloc]initWithFrame:CGRectMake(0,0, screenWidth, screenHeight) style:UITableViewStylePlain];
    self.mainTableView.delegate = self;
    self.mainTableView.dataSource = self;
    self.mainTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    [self.view addSubview:_mainTableView];
}
#pragma mark -UITableViewDelegate,UITabBarDelegate.
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    static NSString *cellID = @"cellID";
    UITableViewCell *cell = [self.mainTableView dequeueReusableCellWithIdentifier:cellID];
    if (cell == nil) {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
    }
    cell.textLabel.text = self.dataMarr[indexPath.row];
    return cell;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return self.dataMarr.count;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    switch (indexPath.row) {
        case 0:
            [self.navigationController pushViewController:[[TurntableVC alloc]init] animated:YES];
            break;
        case 1:
            [self.navigationController pushViewController:[[SlotsVC alloc]init] animated:YES];
            break;
        default:
            break;
    }
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
